'''
author:        Wang Chenyang <cy-wang21@mails.tsinghua.edu.cn>
date:          2024-09-23
Copyright © Department of Physics, Tsinghua University. All rights reserved
'''

import literature_format as lf


def test_arXiv_parsing():
    with open("data/arXiv/physics.xml", "rb") as fp:
        response_content = fp.read()
    all_items = lf.arXiv.parse_rss(response_content)
    md_str = lf.markdown.save_to_markdown(all_items)
    with open("data/physics.md", "w", encoding='utf-8') as fp:
        fp.write(md_str)


def test_arXiv_rss():
    new_data = lf.arXiv.batch_update_rss(
        "quant-ph"
    )
    print(len(new_data))
    md_str = lf.markdown.save_to_markdown(new_data)
    with open("data/temp.md", "w", encoding='utf-8') as fp:
        fp.write(md_str)


if __name__ == '__main__':
    # test_arXiv_parsing()
    test_arXiv_rss()
